// Package router
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2023 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
package router

import (
	"APT/internal/controller/admin"
	"APT/internal/middleware"
	"context"
	"github.com/gogf/gf/v2/net/ghttp"
)

func Admin(ctx context.Context, group *ghttp.RouterGroup) {
	group.Middleware(middleware.ServerLog)
	// 兼容后台登录入口
	group.ALL("/login", func(r *ghttp.Request) {
		r.Response.RedirectTo("/admin")
	})

	group.Group("/admin", func(group *ghttp.RouterGroup) {
		// 不校验任何权限
		group.Bind(
			admin.NewBasics().AccountLoginCaptcha,
			admin.NewBasics().AccountLogin,
			admin.NewBasics().AccountSiteConfig,
			admin.NewBasics().AccountSiteLoginConfig,
			admin.NewBasics().AccountSitePing,
		)

		// 验证登录权限 不验证路由地址权限
		group.Bind(
			admin.NewBasics().MemberInfo,
			admin.NewBasics().MemberSelect,
			admin.NewBasics().RoleDynamic,
			admin.NewBasics().NoticePullMessages,
			admin.NewBasics().NoticeUpRead,
			admin.NewBasics().DictDataSelect,
			admin.NewBasics().DictDataSelects,
			admin.NewBasics().AttachmentChooserOption,
			admin.NewBasics().GenCodesBuild,
			admin.NewBasics().GenCodesColumnSelect,
			admin.NewBasics().GenCodesDelete,
			admin.NewBasics().GenCodesColumnList,
			admin.NewBasics().GenCodesEdit,
			admin.NewBasics().GenCodesList,
			admin.NewBasics().GenCodesMaxSort,
			admin.NewBasics().GenCodesPreview,
			admin.NewBasics().GenCodesSelects,
			admin.NewBasics().GenCodesTableSelect,
			admin.NewBasics().GenCodesStatus,
			admin.NewBasics().GenCodesView,
		).Middleware(middleware.AdminAuth)

		// 校验 登录权限、路由地址权限
		group.Bind(
			admin.NewBasics().NoticeList,
			admin.NewBasics().NoticeView,
			admin.NewBasics().NoticeEdit,
			admin.NewBasics().NoticeDelete,
			admin.NewBasics().NoticeMaxSort,
			admin.NewBasics().NoticeStatus,
			admin.NewBasics().NoticeEditNotify,
			admin.NewBasics().NoticeEditNotice,
			admin.NewBasics().NoticeEditLetter,
			admin.NewBasics().NoticeReadAll,
			admin.NewBasics().NoticeMessageList,
			admin.NewBasics().DictTypeTree,
			admin.NewBasics().DictTypeEdit,
			admin.NewBasics().DictTypeDelete,
			admin.NewBasics().MenuEdit,
			admin.NewBasics().MenuDelete,
			admin.NewBasics().MenuList,
			admin.NewBasics().Menu,
			admin.NewBasics().MemberUpdateEmail,
			admin.NewBasics().MemberUpdateMobile,
			admin.NewBasics().MemberUpdateProfile,
			admin.NewBasics().MemberUpdatePwd,
			admin.NewBasics().MemberResetPwd,
			admin.NewBasics().MemberList,
			admin.NewBasics().MemberView,
			admin.NewBasics().MemberEdit,
			admin.NewBasics().MemberDelete,
			admin.NewBasics().MemberStatus,
			admin.NewBasics().AttachmentList,
			admin.NewBasics().AttachmentView,
			admin.NewBasics().AttachmentDelete,
			admin.NewBasics().AttachmentClearKind,
			admin.NewBasics().SysAttachmentKindList,
			admin.NewBasics().SysAttachmentKindView,
			admin.NewBasics().SysAttachmentKindEdit,
			admin.NewBasics().SysAttachmentKindDelete,
			admin.NewBasics().LogClear,
			admin.NewBasics().LogExport,
			admin.NewBasics().LogList,
			admin.NewBasics().LogDelete,
			admin.NewBasics().LogView,
			admin.NewBasics().DeptList,
			admin.NewBasics().DeptView,
			admin.NewBasics().DeptEdit,
			admin.NewBasics().DeptDelete,
			admin.NewBasics().DeptMaxSort,
			admin.NewBasics().DeptOption,
			admin.NewBasics().DeptTreeOption,
			admin.NewBasics().AccountLoginLogout,
			admin.NewBasics().UploadFile,
			admin.NewBasics().UploadCheckMultipart,
			admin.NewBasics().UploadPart,
			admin.NewBasics().ConfigGet,
			admin.NewBasics().ConfigUpdate,
			admin.NewBasics().ConfigGetCash,
			admin.NewBasics().ConfigTypeSelect,
			admin.NewBasics().ConsoleStat,
			admin.NewBasics().LoginLogList,
			admin.NewBasics().LoginLogExport,
			admin.NewBasics().LoginLogDelete,
			admin.NewBasics().SendTestSms,
			admin.NewBasics().SendBindSms,
			admin.NewBasics().SendSms,
			admin.NewBasics().EmsLogList,
			admin.NewBasics().EmsLogView,
			admin.NewBasics().EmsLogEdit,
			admin.NewBasics().EmsLogDelete,
			admin.NewBasics().EmsLogStatus,
			admin.NewBasics().DictDataEdit,
			admin.NewBasics().DictDataDelete,
			admin.NewBasics().DictDataList,
			admin.NewBasics().MonitorUserOffline,
			admin.NewBasics().MonitorUserOnlineList,
			admin.NewBasics().ServeLogList,
			admin.NewBasics().ServeLogExport,
			admin.NewBasics().ServeLogView,
			admin.NewBasics().ServeLogDelete,
			admin.NewBasics().PostEdit,
			admin.NewBasics().PostDelete,
			admin.NewBasics().PostMaxSort,
			admin.NewBasics().PostList,
			admin.NewBasics().PostView,
			admin.NewBasics().PostStatus,
			admin.NewBasics().RoleList,
			admin.NewBasics().RoleUpdatePermissions,
			admin.NewBasics().RoleGetPermissions,
			admin.NewBasics().RoleEdit,
			admin.NewBasics().RoleDelete,
			admin.NewBasics().RoleDataScopeSelect,
			admin.NewBasics().RoleDataScopeEdit,
			admin.NewBasics().BlacklistList,
			admin.NewBasics().BlacklistView,
			admin.NewBasics().BlacklistEdit,
			admin.NewBasics().BlacklistDelete,
			admin.NewBasics().BlacklistStatus,
			admin.NewBasics().SmsLogList,
			admin.NewBasics().SmsLogView,
			admin.NewBasics().SmsLogDelete,
			admin.NewBasics().PrinterList,
			admin.NewBasics().PrinterEdit,
			admin.NewBasics().PrinterDelete,
			admin.NewBasics().PrinterMaxSort,
			admin.NewBasics().PrinterView,
			admin.NewBasics().PrinterCarOrder,
			admin.NewBasics().PrinterFoodOrder,
			admin.NewBasics().PrinterSpaOrder,
			admin.NewBasics().PrinterStatus,
			admin.NewFood(),
			admin.NewPms(),
			admin.NewSpa(),
			admin.NewCar(),
		).Middleware(middleware.AdminAuth, middleware.AdminRole)
	})

	// 注册生成路由
	//genrouter.Register(ctx, group)
}
